package br.com.skytef.beans.POS;

import java.util.ArrayList;
import java.util.List;

import br.com.skytef.entity.OrderDefaultEntity;
import br.com.skytef.entity.OrderEntity;
import br.com.skytef.entity.OrderVMachineEntity;

public class OrderActive {
	OrderDefaultEntity orderDef;
	OrderVMachineEntity orderVm;
	List<ItemSelected> itens;
	List<ItemSelected> errItens;

	public OrderActive() {
		orderDef = new OrderDefaultEntity();
		orderVm = new OrderVMachineEntity();
		itens = new ArrayList<ItemSelected>();
		errItens = new ArrayList<ItemSelected>();
	}

	public void clear() {
		orderDef = new OrderDefaultEntity();
		orderVm = new OrderVMachineEntity();
		this.clearItens();
		this.clearItensErr();
	}
	
	public void clearItens(){
		itens = new ArrayList<ItemSelected>();		
	}
	
	public void clearItensErr(){
		errItens = new ArrayList<ItemSelected>();		
	}

	/*
	 * 
	 */
	public OrderEntity getOrder() {
		OrderEntity order = new OrderEntity();

		if (orderDef.getOrderId() != 0) {
			order = orderDef;
		} else if (orderVm.getOrderId() != 0) {
			order = orderVm;
		}
		return order;
	}
	
	

	public OrderDefaultEntity getOrderDef() {
		return orderDef;
	}

	public void setOrder(OrderDefaultEntity orderDef) {
		this.orderDef = orderDef;
	}

	public OrderVMachineEntity getOrderVm() {
		return orderVm;
	}

	public void setOrder(OrderVMachineEntity order) {
		this.orderVm = order;
	}
	/*
	 * 
	 */
	public List<ItemSelected> getItens() {
		return itens;
	}

	public void setItens(List<ItemSelected> itens) {
		this.itens = itens;
	}

	public void addItem(ItemSelected item) {
		this.itens.add(item);
	}
	/*
	 * 
	 */
	public List<ItemSelected> getErrItens() {
		return errItens;
	}

	public void setErrItens(List<ItemSelected> itens) {
		this.errItens = itens;
	}

	public void addErrItem(ItemSelected item) {
		this.errItens.add(item);
	}	
}
